#pragma once

#include <vector>
#include <deque>
using namespace std;

struct STRU_SBC_QUESTION_ 
{
	BOOL bDeled;
	BOOL bStared;
	CString strQ;
	CString strA;
	int nWebId;

	STRU_SBC_QUESTION_()
	{
		bDeled = FALSE;
		bStared = FALSE;
	};

};


typedef deque<STRU_SBC_QUESTION_> QuestionArray;

// CSBCListCtrl

class CSBCListCtrl : public CListCtrl
{
	DECLARE_DYNAMIC(CSBCListCtrl)

public:
	CSBCListCtrl();
	virtual ~CSBCListCtrl();

protected:
	DECLARE_MESSAGE_MAP()
public:
	virtual  void DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct);
public:
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
protected:
	virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);

public:
	void InitQuestion(QuestionArray& vQIn, BOOL bShowStarOnly = FALSE);
	void RefreshQuestion(BOOL bShowStarOnly);
	BOOL GetQuestionStared(int nIdx);
	BOOL SwitchQuestionStared(int nIdx);
	BOOL SetQuestionDeled(int nIdx);
	int  GetQuestion(const UINT nIdx, CString& strQ, CString& strA);// return qa webid
	BOOL ModifyQuestion(const UINT nIdx, CString& strA, BOOL bDel = FALSE);
	BOOL AddNewQuestion(QuestionArray& vQIn, BOOL bShowStarOnly = FALSE);
	int GetCurrSelItem();
	void ChangeQAContrlState();

private:
	QuestionArray m_vQ;
	UINT m_nQSize;
	HICON m_icnDel;
	HICON m_icnStar;
	HICON m_icnStared;
	afx_msg void OnNMClick(NMHDR *pNMHDR, LRESULT *pResult);
	afx_msg void OnLvnItemchanged(NMHDR *pNMHDR, LRESULT *pResult);
};


